package view.manager;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import dao.DepartmentDao;
import model.Department;
import view.common.About;
import view.common.ChangepassInterfrm;

import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JDesktopPane;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.awt.event.ActionEvent;
import javax.swing.ImageIcon;

public class ManageMainFrm extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	private JDesktopPane desktopPane;

	/**
	 * Create the frame.
	 */
	public ManageMainFrm() {
		setTitle("学生成绩管理系统管理员界面");
		setSize(new Dimension(640,480));
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//		setBounds(100, 100, 904, 590);

		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);

		JMenu mnNewMenu_5 = new JMenu("个人中心");
		mnNewMenu_5.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/person.png")));
		menuBar.add(mnNewMenu_5);

		JMenuItem mntmNewMenuItem_4 = new JMenuItem("修改个人资料");
		mntmNewMenuItem_4.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ModifyInfoInterfrm modifyInfoInterfrm = new ModifyInfoInterfrm();
				modifyInfoInterfrm.setVisible(true);
				desktopPane.add(modifyInfoInterfrm);
			}
		});
		mntmNewMenuItem_4.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/modify.png")));
		mnNewMenu_5.add(mntmNewMenuItem_4);

		JMenuItem mntmNewMenuItem_3 = new JMenuItem("修改密码");
		mntmNewMenuItem_3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ChangepassInterfrm changepassInterfrm = new ChangepassInterfrm();
				changepassInterfrm.setVisible(true);
				desktopPane.add(changepassInterfrm);
			}
		});
		mntmNewMenuItem_3.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/modify_pass.png")));
		mnNewMenu_5.add(mntmNewMenuItem_3);

		JMenuItem mntmNewMenuItem_1_1 = new JMenuItem("退出系统");
		mntmNewMenuItem_1_1.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/exit.png")));
		mntmNewMenuItem_1_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				int res = JOptionPane.showConfirmDialog(null, "是否退出系统");
				if (res == 0) {
					dispose();
				}
			}
		});
		mnNewMenu_5.add(mntmNewMenuItem_1_1);

		JMenu mnNewMenu = new JMenu("部门");
		mnNewMenu.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/Administration.png")));
		menuBar.add(mnNewMenu);

		JMenu mnNewMenu_2 = new JMenu("学院");
		mnNewMenu_2.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/describe.png")));
		mnNewMenu.add(mnNewMenu_2);

		JMenuItem mntmNewMenuItem_2 = new JMenuItem("添加学院");
		mntmNewMenuItem_2.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/add.png")));
		mntmNewMenuItem_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				DepartmentAddInterfrm departmentAddInterfrm = new DepartmentAddInterfrm();
				departmentAddInterfrm.setVisible(true);
				desktopPane.add(departmentAddInterfrm);
			}
		});
		mnNewMenu_2.add(mntmNewMenuItem_2);

		JMenuItem mntmNewMenuItem_5 = new JMenuItem("学院管理");
		mntmNewMenuItem_5.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/updata.png")));
		mntmNewMenuItem_5.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				DepartmentEditInterfrm departmentEditInterfrm = new DepartmentEditInterfrm();
				departmentEditInterfrm.setVisible(true);
				desktopPane.add(departmentEditInterfrm);
			}
		});
		mnNewMenu_2.add(mntmNewMenuItem_5);

		JMenu mnNewMenu_3 = new JMenu("系部");
		mnNewMenu_3.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/describe.png")));
		mnNewMenu.add(mnNewMenu_3);

		JMenuItem mntmNewMenuItem_6 = new JMenuItem("添加系");
		mntmNewMenuItem_6.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				MajorAddInterfrm majorAddInterfrm = new MajorAddInterfrm();
				majorAddInterfrm.setVisible(true);
				desktopPane.add(majorAddInterfrm);
			}
		});
		mntmNewMenuItem_6.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/add.png")));
		mnNewMenu_3.add(mntmNewMenuItem_6);

		JMenuItem mntmNewMenuItem_7 = new JMenuItem("系部管理");
		mntmNewMenuItem_7.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				MajorEditInterfrm majorEditInterfrm = new MajorEditInterfrm();
				majorEditInterfrm.setVisible(true);
				desktopPane.add(majorEditInterfrm);
			}
		});
		mntmNewMenuItem_7.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/updata.png")));
		mnNewMenu_3.add(mntmNewMenuItem_7);
		
		JMenu mnNewMenu_10 = new JMenu("班级");
		mnNewMenu_10.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/describe.png")));
		mnNewMenu.add(mnNewMenu_10);
		
		JMenuItem mntmNewMenuItem_13 = new JMenuItem("添加班级");
		mntmNewMenuItem_13.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/add.png")));
		mntmNewMenuItem_13.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ClassAddInterfrm classAddInterfrm = new ClassAddInterfrm();
				classAddInterfrm.setVisible(true);
				desktopPane.add(classAddInterfrm);
			}
		});
		mnNewMenu_10.add(mntmNewMenuItem_13);
		
		JMenuItem mntmNewMenuItem_14 = new JMenuItem("班级管理");
		mntmNewMenuItem_14.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ClassEditInterfrm classEditInterfrm = new ClassEditInterfrm();
				classEditInterfrm.setVisible(true);
				desktopPane.add(classEditInterfrm);
			}
		});
		mntmNewMenuItem_14.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/updata.png")));
		mnNewMenu_10.add(mntmNewMenuItem_14);

		JMenu mnNewMenu_6 = new JMenu("课程");
		mnNewMenu_6.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/Administration.png")));
		menuBar.add(mnNewMenu_6);

		JMenu mnNewMenu_7 = new JMenu("课程");
		mnNewMenu_7.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/课程表.png")));
		mnNewMenu_6.add(mnNewMenu_7);

		JMenuItem mntmNewMenuItem_1 = new JMenuItem("添加课程");
		mntmNewMenuItem_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CourseAddInterfrm courseAddInterfrm = new CourseAddInterfrm();
				courseAddInterfrm.setVisible(true);
				desktopPane.add(courseAddInterfrm);
			}
		});
		mntmNewMenuItem_1.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/add.png")));
		mnNewMenu_7.add(mntmNewMenuItem_1);

		JMenuItem mntmNewMenuItem_9 = new JMenuItem("管理课程");
		mntmNewMenuItem_9.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CourseEditInterfrm courseEditInterfrm = new CourseEditInterfrm();
				courseEditInterfrm.setVisible(true);
				desktopPane.add(courseEditInterfrm);
			}
		});
		mntmNewMenuItem_9.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/updata.png")));
		mnNewMenu_7.add(mntmNewMenuItem_9);
		
		JMenu mnNewMenu_11 = new JMenu("选课管理");
		mnNewMenu_11.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/set.png")));
		mnNewMenu_6.add(mnNewMenu_11);
		
		JMenuItem mntmNewMenuItem_15 = new JMenuItem("学生选课");
		mntmNewMenuItem_15.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/学生.png")));
		mnNewMenu_11.add(mntmNewMenuItem_15);
		
		JMenuItem mntmNewMenuItem_16 = new JMenuItem("教师选课");
		mntmNewMenuItem_16.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				TeacherSelectionCourseInterfrm courseSelectionInterfrm = new TeacherSelectionCourseInterfrm();
				courseSelectionInterfrm.setVisible(true);
				desktopPane.add(courseSelectionInterfrm);
			}
		});
		mntmNewMenuItem_16.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/教师管理.png")));
		mnNewMenu_11.add(mntmNewMenuItem_16);
		mntmNewMenuItem_15.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				StudentSelectionCourseInterfrm courseSelectionInterfrm = new StudentSelectionCourseInterfrm();
				courseSelectionInterfrm.setVisible(true);
				desktopPane.add(courseSelectionInterfrm);
			}
		});
		
		JMenu mnNewMenu_8 = new JMenu("人员");
		mnNewMenu_8.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/Administration.png")));
		menuBar.add(mnNewMenu_8);
		
				JMenu mnNewMenu_4 = new JMenu("教师");
				mnNewMenu_8.add(mnNewMenu_4);
				mnNewMenu_4.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/教师管理.png")));
				
						JMenuItem mntmNewMenuItem_8 = new JMenuItem("添加教师");
						mntmNewMenuItem_8.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent e) {
								TeacherAddInterfrm teacherAddInterfrm = new TeacherAddInterfrm();
								teacherAddInterfrm.setVisible(true);
								desktopPane.add(teacherAddInterfrm);
							}
						});
						mntmNewMenuItem_8.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/add.png")));
						mnNewMenu_4.add(mntmNewMenuItem_8);
						
								JMenuItem mntmNewMenuItem_10 = new JMenuItem("教师管理");
								mntmNewMenuItem_10.addActionListener(new ActionListener() {
									public void actionPerformed(ActionEvent e) {
										TeacherEditInterfrm teacherEditInterfrm = new TeacherEditInterfrm();
										teacherEditInterfrm.setVisible(true);
										desktopPane.add(teacherEditInterfrm);
									}
								});
								mntmNewMenuItem_10.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/updata.png")));
								mnNewMenu_4.add(mntmNewMenuItem_10);
		
		JMenu mnNewMenu_9 = new JMenu("学生");
		mnNewMenu_9.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/学生.png")));
		mnNewMenu_8.add(mnNewMenu_9);
		
		JMenuItem mntmNewMenuItem_11 = new JMenuItem("添加学生");
		mntmNewMenuItem_11.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/add.png")));
		mntmNewMenuItem_11.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				StudentAddInterfrm studentAddInterfrm = new StudentAddInterfrm();
				studentAddInterfrm.setVisible(true);
				desktopPane.add(studentAddInterfrm);
			}
		});
		mnNewMenu_9.add(mntmNewMenuItem_11);
		
		JMenuItem mntmNewMenuItem_12 = new JMenuItem("学生管理");
		mntmNewMenuItem_12.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/updata.png")));
		mntmNewMenuItem_12.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				StudentEditInterfrm studentEditInterfrm = new StudentEditInterfrm();
				studentEditInterfrm.setVisible(true);
				desktopPane.add(studentEditInterfrm);
			}
		});
		mnNewMenu_9.add(mntmNewMenuItem_12);

		JMenu mnNewMenu_1 = new JMenu("关于我们");
		mnNewMenu_1.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/关于.png")));
		menuBar.add(mnNewMenu_1);

		JMenuItem mntmNewMenuItem = new JMenuItem("关于我们");
		mntmNewMenuItem.setIcon(new ImageIcon(ManageMainFrm.class.getResource("/images/关于我们-02.png")));
		mntmNewMenuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				About about = new About();
				about.setVisible(true);
				desktopPane.add(about);
			}
		});
		mnNewMenu_1.add(mntmNewMenuItem);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0, 0));

		desktopPane = new JDesktopPane();
		contentPane.add(desktopPane, BorderLayout.CENTER);

		setExtendedState(JFrame.MAXIMIZED_BOTH);
	}
}
